/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package wwcontrol;

import com.phidgets.*;
import com.phidgets.event.*;
/**
 *
 * @author Michael Ferry
 */
public class IntefaceKitPhidget_pHORP {
    private int ikf_pHORP_serial=174418;
    private InterfaceKitPhidget ikf_pHORP;
    //sensors attached to this device (positions 0-7)
    //Sensor Input 1: Phidgets 1130 pH/ORP adapter - set to pH
    //Sensor Input 2: Phidgets 1130 ORP adapter - set to ORP
    //Sensor Input 3: Phidgets 1124 Precision temperature sensor
    
    public IntefaceKitPhidget_pHORP(){
        try{
        ikf_pHORP = new InterfaceKitPhidget();
        ikf_pHORP.addAttachListener(new AttachListener() {

            public void attached(AttachEvent ae) {
                System.out.println("attachment of " + ae);
                //jCheckBox1.setSelected(true);
                //if(ae.getSource().getSerialNumber(){                   
                //}                   
            }
        });
        ikf_pHORP.addDetachListener(new DetachListener() {

            public void detached(DetachEvent ae) {
                System.out.println("detachment of " + ae);
                //jCheckBox1.setSelected(false);
            }
        });
        ikf_pHORP.addErrorListener(new ErrorListener() {

            public void error(ErrorEvent ee) {
                //System.out.println(ee);
            }
        });
        ikf_pHORP.addInputChangeListener(new InputChangeListener() {

            public void inputChanged(InputChangeEvent oe) {
                //System.out.println(oe);
            }
        });
        ikf_pHORP.addOutputChangeListener(new OutputChangeListener() {

            public void outputChanged(OutputChangeEvent oe) {
                //System.out.println(oe);
            }
        });
        ikf_pHORP.addSensorChangeListener(new SensorChangeListener() {

            public void sensorChanged(SensorChangeEvent se) {
                //System.out.println(se);
            }
        });
        ikf_pHORP.open(ikf_pHORP_serial);
        System.out.println("waiting for InterfaceKit attachment...");      
        ikf_pHORP.waitForAttachment();
        System.out.println(ikf_pHORP.getDeviceName());
        
        
        
        }catch(PhidgetException ex){
            System.out.println(ex.getDescription()+ "Phidget Error" + ex.getErrorNumber());
            //JOptionPane.showMessageDialog(this, ex.getDescription(), "Phidget Error" + ex.getErrorNumber(), JOptionPane.ERROR_MESSAGE);
            //dispose();
            //System.exit(0);
        };
    }
   
}
